﻿@model ICollection<AuthenticationClientData>


@using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "social", id = "socialLogin" }))
{
    @Html.AntiForgeryToken()
    <input id="provider" type="hidden" name="provider" value="" />
    if (Model.Count > 0)
    {
    <ul>
        <!--<li><a href="#" onclick="var prov = 'vkontakte'; socialLogin();"><i class="icon icon-vk"></i></a></li>-->
        @foreach (AuthenticationClientData p in Model)
        {
            switch (p.AuthenticationClient.ProviderName)
            {
                case "google": <li><a href="javascript:socialLogin('google')"><i class="icon icon-g"></i></a></li>
                    break;
                case "facebook":<li><a href="javascript:socialLogin('facebook')"><i class="icon icon-fb"></i></a></li>
                    break;
                case "twitter": <li><a href="javascript:socialLogin('twitter')"><i class="icon icon-tw"></i></a></li>
                    break;
                default:
                    break;
            }
            //<button type="submit" name="provider" value="@p.AuthenticationClient.ProviderName" title="Log in using your @p.DisplayName account">@p.DisplayName</button>
        }
    </ul>
    }
    <script type="text/javascript">
        function socialLogin(provider) { document.getElementById('provider').value = provider; document.getElementById('socialLogin').submit() }
    </script>
}
